function getVerify(btn){
    var countdown=60;
    setTime(btn);
    var mail=document.getElementById("mail").value;
    $.post(
        CONTEXT_PATH + "/mailVerify",{"mail":mail},
        function(data) {
            data = $.parseJSON(data);
            if(data.code == 0) {
                document.getElementById("kaptchaKey").value=data.verifyKey;
            }else{
                if(data.resultMsg==0){
                    alert("该邮箱未注册！");
                }else{
                    alert("验证码发送失败！");
                }
            }
            document.getElementById("mail").value=data.email;
        }
    );

    function setTime(btn) {
        if (countdown == 0) {
            btn.removeAttribute("disabled");
            btn.value="获取验证码";
            // countdown = 60;
        } else {
            btn.setAttribute("disabled", true);
            btn.value="重新发送(" + countdown + ")";
            countdown--;
        }
        setTimeout(function() {
            setTime(btn)
        },1000)
    }
}